package com.mktech.taraservice.db.base;

import com.mktech.taraservice.service.TaraApplication;

import android.content.ContentResolver;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;

public class BaseDBManager implements BaseColumn, BaseDBImpl
{
	public static final String AUTHORIES = "com.mktech.taraservice.contentprovider";
	public static final String URI_BASE = "content://" + AUTHORIES + "/";
	
	@Override
	public int delete(String tableName, String selection, String[] selectionArgs)
	{
		// TODO Auto-generated method stub
		ContentResolver resolver = TaraApplication.getApp().getContentResolver();
		return resolver.delete(Uri.parse(URI_BASE + tableName), selection, selectionArgs);
	}

	@Override
	public Uri insert(String tableName, ContentValues values)
	{
		// TODO Auto-generated method stub
		ContentResolver resolver = TaraApplication.getApp().getContentResolver();
		return resolver.insert(Uri.parse(URI_BASE + tableName), values);
	}

	@Override
	public Cursor query(String tableName, String[] projection, String selection, String[] selectionArgs, String sortOrder)
	{
		// TODO Auto-generated method stub
		ContentResolver resolver = TaraApplication.getApp().getContentResolver();
		return resolver.query(Uri.parse(URI_BASE + tableName), projection, selection, selectionArgs, sortOrder);
	}

	@Override
	public int update(String tableName, ContentValues values, String selection, String[] selectionArgs)
	{
		// TODO Auto-generated method stub
		ContentResolver resolver = TaraApplication.getApp().getContentResolver();
		return resolver.update(Uri.parse(URI_BASE + tableName), values, selection, selectionArgs);
	}

}
